package cn.tedu.store.service;

import cn.tedu.store.entity.User;
import cn.tedu.store.service.ex.InsertException;
import cn.tedu.store.service.ex.PasswordNotMatchException;
import cn.tedu.store.service.ex.UpdateException;
import cn.tedu.store.service.ex.UserNotFoundException;
import cn.tedu.store.service.ex.UsernameDuplicateException;

public interface IUserService {
	/**
	 * 用户注册
	 * @param user   用户数据对象
	 * @throws UsernameDuplicateException  用户名存在异常
	 * @throws InsertException   插入数据异常
	 */
	 void reg(User user) throws UsernameDuplicateException,InsertException;
	 
	 /**
	  * 用户登录
	  * @param username
	  * @param password
	  * @return
	  * @throws UserNotFoundException
	  * @throws PasswordNotMatchException
	  */
	 User login(String username, String password)
			 throws UserNotFoundException,PasswordNotMatchException;
	 /**
	  * 修改密码
	  * @param uid
	  * @param username
	  * @param oldPassword
	  * @param newPassword
	  * @throws UserNotFoundException
	  * @throws PasswordNotMatchException
	  * @throws UpdateException
	  */
	 void changPassword(Integer uid, String username, String oldPassword, String newPassword) throws UserNotFoundException,PasswordNotMatchException,
	 UpdateException;
	 
	 void changeAvatar(Integer uid, String username, String avatar) throws UserNotFoundException,PasswordNotMatchException,
	 UpdateException;
	 
	 User getByUid(Integer uid);
	 void changeInfo(User user) throws UserNotFoundException,UpdateException ;
	 
	 
}
